﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
enum CharacterEnum
{
    ADMIN,//默认0 管理员
    SUPERADMIN//默认1 超级管理员
}


namespace Battery
{
    public partial class Form2 : Form
    {

        public bool SystemRight = false;
        int character = (int)CharacterEnum.ADMIN;//默认是用户角色

        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "266992" || textBox1.Text == "123456")
            {
                if (textBox1.Text == "123456")
                {
                    character=(int)CharacterEnum.ADMIN;//管理员角色
                }
                else
                {
                    character = (int)CharacterEnum.SUPERADMIN;//超级管理员角色
                }
                SystemRight = true;
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("密码错误");
            }
        }

        public int getCharacter()
        {
            return character;//获取角色值
        }
    }
}
